<?php
$topic = $this->topic_info;
$commends = $this->commend_list;
$gallery = $this->gallery;


?>
<!--Topic detail -->
<div class="row-fluid sortable ui-sortable">
    <div class="box span12">
        <div class="box-header well" data-original-title="">
            <h2><i class="icon-font"></i> <?php echo $topic->title; ?></h2>
            <div class="box-icon">
                <a href="#" class="btn btn-setting btn-round"><i class="icon-cog"></i></a>
                <a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
                <a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
            </div>
        </div>
        <div class="box-content">
            <div class="row-fluid">
                <div class="span4">
                    <img src="<?php echo $this->serverUrl() ?><?php echo $topic->images; ?>">
                </div>
                <div class="span8">
                    <h2><?php echo $topic->title; ?></h2>
                    <p><?php echo $topic->short_description; ?></p>
                    <div class="tooltip-demo well">
                        <p class="muted" style="margin-bottom: 0;">
                            <?php
                                echo $topic->full_description;
                            ?>
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div><!--/span-->
</div>
<!--end topic detail -->

<!--Topic Commend -->
<div class="row-fluid sortable ui-sortable">
    <div class="box span12">
        <div class="box-header well" data-original-title="">
            <h2><i class=""></i> <?php echo 'Commend' ?></h2>
            <div class="box-icon">
                <a href="#" class="btn btn-setting btn-round"><i class="icon-cog"></i></a>
                <a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
                <a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
            </div>
        </div>
        <div class="box-content">

                <!--Loop commend for topic -->
                <?php

                    foreach($commends as $commend){
                ?>
            <div class="row-fluid">

                <div class="span12">
                    <h3>Commend by: <?php echo $commend->user_id; ?> <small><?php echo $commend->create_date; ?></small></h3>
                    <div class="row-fluid">
                        <div class="btn-group">
                            <a class="btn btn-mini btn-primary" href="<?php echo $this->url("admin/child",array('controller'=>'commend','action'=>'edit','id'=>$commend->id,'topic_id'=>$topic->id)) ?>" >Edit Commend</a>
                            <a class="btn btn-mini btn-danger" href="<?php echo $this->url("admin/child",array('controller'=>'commend','action'=>'delete','id'=>$commend->id,'topic_id'=>$topic->id)) ?>">Delete Commend</a>
                        </div>
                    </div>
                    <div class="tooltip-demo well">
                        <p class="muted" style="margin-bottom: 0;">
                          <?php echo $commend->content ?>
                        </p>
                    </div>
                </div>

            </div>

                    <?php
                    }
                ?>
            <div class="row-fluid">
                <?php // add at the end of the file after the table
                echo $this->paginationControl(
                // the paginator object
                    $commends,
                    // the scrolling style; see http://zf2.readthedocs.org/en/release-2.1.4/modules/zend.paginator.usage.html#rendering-pages-with-view-scripts
                    'sliding',
                    // the partial to use to render the control
                    array('partial/paginator.phtml', 'topic'),
                    // the route to link to when a user clicks a control link
                    array(
                        'route' => 'admin/child',
                        'child_route' => array('controller'=>'topic','action'=>'detail','id'=>$topic->id)
                    )
                );
                ?>
            </div>
            <div class="row-fluid">

            <div class="span12">
                    <h3>Write Comment</h3>
                    <div class="tooltip-demo well">
                        <form class="horizontal" method="post" action="<?php echo $this->url('admin/child',array('controller'=>'commend', 'action'=>'add')) ?>" class="form-horizontal">
                            <fieldset>
                                <div class="control-group">
                                    <input type="hidden" value="<?php echo $this->user_id; ?>" name="user_id">
                                </div>
                                <div class="control-group">
                                    <input type="hidden" value="<?php echo $topic->id ?>" name="topic_id">
                                </div>
                                <div class="control-group">
                                    <textarea name="content" class="span12"> </textarea>
                                </div>
                                <div class="form-actions">
                                    <button type="submit" class="btn btn-primary">Commend</button>
                                </div>
                            </fieldset>
                        </form>

                    </div>
                </div>
             </div>
            <!--Topic Galery -->
            <div class="row-fluid sortable ui-sortable">
                <div class="box span12">
                    <div class="box-header well" data-original-title="">
                        <h2><i class="icon-picture"></i> Gallery</h2>
                        <div class="box-icon">
                            <a href="#" class="btn btn-setting btn-round"><i class="icon-cog"></i></a>
                            <a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
                            <a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
                        </div>
                    </div>
                    <div class="box-content">
                        <p class="center">
                            <button id="toggle-fullscreen" class="btn btn-large btn-primary visible-desktop" data-toggle="button">Toggle Fullscreen</button>
                        </p>
                        <br>
                        <ul class="thumbnails gallery">

                            <?php
                            if($gallery){
                                foreach($gallery as $g) {

                                    ?>
                                    <li id="image-1" class="thumbnail">
                                        <a style="background:url(<?php echo $g->link ?>)" href="<?php  echo $g->link ?>" class="cboxElement"><img class="grayscale" src="<?php echo $g->link ?>" ></a>
                                    </li>

                                <?php }
                            }?>

                        </ul>
                    </div>
                </div><!--/span-->

            </div>
            <!--End Topic Galery -->
            <!--End Loop commend for topic -->
        </div>
    </div><!--/span-->
</div>
<!--End Topic Commend -->


